##############################################################
## MOD Title: Effects Store for Shop 3
## MOD Author: Thoul < thoul@phpbbsmith.com > ( Jeremy Rogers ) http://www.phpbbsmith.com
## MOD Description: Adds a special effects store to Shop 3.
## MOD Version: 1.1.0
##
## Installation Level: Intermediate
## Installation Time: 3 Minutes
## Files To Edit:
##		includes/usercp_register.php
## Included Files:
##		install.php,
##		shop_effects.php,
##		mods/shopaddons/effects.php,
##		mods/shopaddons/colors.js,
##		templates/subSilver/shop/effects.tpl,
##		templates/subSilver/shop/personal.tpl,
##		templates/subSilver/admin/shop_effects_config.tpl,
##		language/lang_english/lang_effects.php
## License: contrib/license.txt GNU General Public License v2
##############################################################
## Author Notes:
##
## These are instructions from upgrading this modification from version 1.0.0 to
## version 1.1.0.  If you are installing this modification for the first time,
## please see the instructions in file_edits.txt instead.
##
## On some templates, the glow and shadow effects may not work in Internet
## Explorer browsers.  If you encounter such behavior, please see the 
## contrib/fix_doctype.txt for further instructions.  This generally isn't need
## on subSilver.
##
##############################################################
## BEFORE FOLLOWING THESE INSTRUCTIONS, YOU SHOULD BACK UP ALL RELATED FILES.
##############################################################

#
#-----[ COPY ]------------------------------------------
#

root/shop_effects.php to shop_effects.php
root/mods/shopaddons/effects.php to mods/shopaddons/effects.php
root/mods/shopaddons/colors.js to mods/shopaddons/colors.js
root/language/lang_english/lang_effects.php to language/lang_english/lang_effects.php
root/templates/subSilver/admin/shop_effects_config.tpl to templates/subSilver/admin/shop_effects_config.tpl
root/templates/subSilver/shop/effects.tpl to templates/subSilver/shop/effects.tpl

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#

Run install.php by visiting it in your web browser, for example
http://www.yoursite.com/phpBB2/install.php
Choose the "Upgrade" option.
This will upgrade the database portions of the hack. If you prefer to run the
queries manually, check contrib/upgrades/100_to_110.sql.

#
#-----[ OPEN ]--------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]--------------------------------------
#

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
	exit;
}

#
#-----[ AFTER, ADD ]--------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]--------------------------------------
#

	if ( $board_config['allow_namechange'] || $mode == 'register' )

#
#-----[ BEFORE, ADD ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:  ($board_config['allow_namechange'] && $effects->check_namechange($userdata))
//		Original phpBB Code:
	if ( $board_config['allow_namechange'] || $mode == 'register' )
*/

#
#-----[ IN-LINE FIND ]--------------------------------------
#

$board_config['allow_namechange']

#
#-----[ IN-LINE REPLACE WITH ]--------------------------------------
#

($board_config['allow_namechange'] && $effects->check_namechange($userdata))

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]--------------------------------------
#

	if ( ($mode == 'register') || ($board_config['allow_namechange']) )

#
#-----[ BEFORE, ADD ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:   && $effects->check_namechange($userdata)
//		Original phpBB Code:
	if ( ($mode == 'register') || ($board_config['allow_namechange']) )
*/

#
#-----[ IN-LINE FIND ]--------------------------------------
#

$board_config['allow_namechange']

#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------
#

 && $effects->check_namechange($userdata)

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]--------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3.0.0 - Begin Code Alteration
//
	$effects = array('avatar' => TRUE, 'signature' => TRUE);
	if ( $board_config['effects_enable'] )
	{
		if ( $board_config['effects_avatar'] && !$userdata['effects_avatar'] )
		{
			$effects['avatar'] = FALSE;
		}
		if ( $mode == 'register' || ($board_config['effects_signature'] && !$userdata['effects_signature']) )
		{
			$effects['signature'] = FALSE;
		}

		if( ($userdata['user_level'] == ADMIN && $board_config['effects_admin'] ) || ($userdata['user_level'] == MOD && $board_config['effects_moderator']) )
		{
			$effects = array('avatar' => TRUE, 'signature' => TRUE);
		}
	}

	if( $effects['signature'] )
	{
		$template->assign_block_vars('signature', array());
	}
//
// Effects Store for Shop 3.0.0 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ REPLACE WITH ]--------------------------------------
#
# Nothing, just delete it
#

#
#-----[ FIND ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3.0.0 - Begin Code Alteration
//		Added:  $effects['avatar'] && 
//		Original phpBB Code:
		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
*/

#
#-----[ REPLACE WITH ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:  $effect_check['avatar'] && 
//		Original phpBB Code:
		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
*/
		$effect_check = $effects->profile_edit_check($userdata);

#
#-----[ FIND ]------------------------------------------
#

		if ( $effects['avatar'] && $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )

#
#-----[ IN-LINE FIND ]--------------------------------------
#

$effects['avatar']

#
#-----[ IN-LINE REPLACE WITH ]--------------------------------------
#

$effect_check['avatar']

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM